// 图表chart resize
import _ from "lodash";
export let resize = {
  mounted() {
    let chartResize = _.debounce(() => {
      // one
      if (this.chart) {
        this.chart.resize();
      } else if (this.chartOne) {
        this.chartOne.resize();
      } else if (this.chartTwo) {
        this.chartTwo.resize();
      } else if (this.chartThree) {
        this.chartThree.resize();
      } else if (this.chartFour) {
        this.chartFour.resize();
      } else if (this.chartFive) {
        this.chartFive.resize();
      } else if (this.chartSix) {
        this.chartSix.resize();
      }

      if (this.dChartOne) {
        this.dChartOne.resize();
      }
      if (this.chart) {
        this.chart.resize();
      }
      if (this.chartOne) {
        this.chartOne.resize();
      }
      if (this.chartTwo) {
        this.chartTwo.resize();
      }
      if (this.chartThree) {
        this.chartThree.resize();
      }
      if (this.chartFour) {
        this.chartFour.resize();
      }
      if (this.chartFive) {
        this.chartFive.resize();
      }
      if (this.chartSix) {
        this.chartSix.resize();
      }
      if (this.chartSeven) {
        this.chartSeven.resize();
      }
      if (this.chartEight) {
        this.chartEight.resize();
      }
      if (this.chartAnalysisOne) {
        this.chartAnalysisOne.resize();
      }
      if (this.chartAnalysisTwo) {
        this.chartAnalysisTwo.resize();
      }
    }, 100);
    window.addEventListener("resize", chartResize, false);
  },
  destroyed() {
    window.removeEventListener("resize", () => {}, false);
  },
};

// 颜色转换 16进制转换为RGB
export function hexToRgba(hex) {
  // 16进制颜色值的正则
  let reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  // 把颜色值变成小写
  let color = hex.toLowerCase();
  if (reg.test(color)) {
    // 如果只有三位的值，需变成六位，如：#fff => #ffffff
    if (color.length === 4) {
      var colorNew = "#";
      for (var i = 1; i < 4; i += 1) {
        colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
      }
      color = colorNew;
    }
    // 处理六位的颜色值，转为RGB
    var colorChange = [];
    for (var i = 1; i < 7; i += 2) {
      colorChange.push(parseInt("0x" + color.slice(i, i + 2)));
    }
    return colorChange.join(",");
  } else {
    return color;
  }
}
// 颜色转换 RGB转换为16进制
export function rgbToHex(color) {
  // RGB颜色值的正则
  let reg = /^(rgb|RGB)/;
  if (reg.test(color)) {
    var strHex = "#";
    // 把RGB的3个数值变成数组
    var colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
    // 转成16进制
    for (var i = 0; i < colorArr.length; i++) {
      var hex = Number(colorArr[i]).toString(16);
      if (hex === "0") {
        hex += hex;
      }
      strHex += hex;
    }
    return strHex;
  } else {
    return String(color);
  }
}

// 获取年份
export function getYear(range = 10) {
  let year = new Date().getFullYear();
  let startYear = year - range;
  let endYear = year;
  return { startYear, endYear };
}

// 获取日期
export function getDate(range = 10) {
  let startM = moment().add(`-${range}`, "year");
  let startDate = startM.format("YYYY-MM-DD");
  let endDate = moment().format("YYYY-MM-DD");
  return { startDate, endDate };
}

// 文字过长换行
export function spaceTxt(txt, space = 10) {
  let _space = space
  let regx_zh = /^[\u4e00-\u9fa5]*$/; // 是否是中文
  if (regx_zh.test(txt)) {
    _space = 6
  }
  let number = Math.ceil(txt.length / _space);
  let newTxt = "";
  for (let j = 0; j < number; j++) {
    newTxt += txt.substr(j * _space, _space);
    if (j < number - 1) {
      newTxt += "\n";
    }
  }
  return newTxt;
}

// 还原过长加\n的文字
export function noSpaceTxt(txt) {
  txt = txt.replace(/\n/, "");
  return txt;
}

// canvas图片下载
export function downloadChartImg(chart) {
  let base64Url = chart.getDataURL({
    pixelRatio: 2.5,
    // backgroundColor: '#fff' // 背景是动态配置的，不用写死
  });
  let parts = base64Url.split(";base64,");
  let contentType = parts[0].split(":")[1];
  let raw = window.atob(parts[1]);
  let rawLength = raw.length;
  let uInt8Array = new Uint8Array(rawLength);
  for (var i = 0; i < rawLength; ++i) {
    uInt8Array[i] = raw.charCodeAt(i);
  }
  // 组装参数
  let params = {
    res: uInt8Array,
    type: contentType,
    Suffix: "jpeg",
    title: name,
  };
  downloadAPI(params);
}

// echarts图表图片转为base64
export function chartImgBase64(chart) {
  let base64Url = chart.getDataURL({
    pixelRatio: 2.5,
    backgroundColor: '#fff'
  });
  return base64Url;
}

function downloadAPI(params) {
  const res = params.res,
    type = params.type,
    Suffix = params.Suffix,
    title = params.title,
    noDate = params.noDate ? params.noDate : false;
  // 创建 blob
  const blob = new Blob([res], { type: type });
  // 创建时间戳
  let date = new Date().getTime();
  if (noDate) {
    date = "";
  }
  // 创建下载的链接
  const downloadElement = document.createElement("a");
  const href = window.URL.createObjectURL(blob);
  // 判断浏览器
  if (myBrowser() === "IE" || myBrowser() === "Edge") {
    // IE 专属下载方法
    navigator.msSaveBlob(blob, title + date + "." + Suffix);
  } else {
    downloadElement.href = href;
    // 下载后文件名
    downloadElement.download = title + date + "." + Suffix;
    document.body.appendChild(downloadElement);
    // 点击下载
    downloadElement.click();
    // 下载完成移除元素
    document.body.removeChild(downloadElement);
    // 释放掉 blob 对象
    window.URL.revokeObjectURL(href);
  }
}

// 判断浏览器类型
function myBrowser() {
  var userAgent = navigator.userAgent; // 取得浏览器的 userAgent 字符串
  var isOpera = userAgent.indexOf("Opera") > -1;
  if (isOpera) {
    return "Opera";
  } // 判断是否 Opera 浏览器
  if (userAgent.indexOf("Firefox") > -1) {
    return "FF";
  } // 判断是否 Firefox 浏览器
  if (userAgent.indexOf("Chrome") > -1) {
    return "Chrome";
  }
  if (userAgent.indexOf("Safari") > -1) {
    return "Safari";
  } // 判断是否 Safari 浏览器
  if (
    userAgent.indexOf("compatible") > -1 &&
    userAgent.indexOf("MSIE") > -1 &&
    !isOpera
  ) {
    return "IE";
  } // 判断是否 IE 浏览器
  if (userAgent.indexOf("Trident") > -1) {
    return "Edge";
  } // 判断是否 Edge 浏览器
}

// 转义Sub的xml格式标签
export function xmlEscape(txt) {
  let regx = [{ origin: "base:Sub>", parse: "sub>" }];
  regx.forEach((v) => {
    if (txt.indexOf(v.origin) > -1) {
      txt = txt.split(v.origin).join(v.parse);
    }
  });
  return txt;
}

// 千分符
export function thousands(number) {
  let intPart = Number(number).toFixed(0);
  let intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,");
  return intPartFormat;
}

// 千分位分隔符
export function numFormat(val) {
  let intPart = Number(val).toFixed(0);
  let intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,");
  return intPartFormat;
}

// 检索关键词高亮
export function wordLight(text, word) {
  // 注意 需要先对输入字符进行转义处理，new RegExp中如果出现未转义字符 会报错阻塞
  word = word.replace(/\W/gi, function(s, value) {
    return "\\" + s;
  });
  let reg = new RegExp(word, "gi");
  text = text.replace(reg, function(s, value) {
    return `<i class="highlight">${s}</i>`;
  });
  return text;
}

// 高亮模式
export function wordsLight(text, settings) {
  // 注意 需要先对输入字符进行转义处理，new RegExp中如果出现未转义字符 会报错阻塞
  let bEle = document.createElement("b");
  bEle.id = "tempHighligh";
  bEle.innerHTML = text;
  settings.forEach((v) => {
    if (v.words !== "") {
      let word = v?.words?.replace(/\W/gi, function(s, value) {
        return "\\" + s;
      });
      let reg = new RegExp(word, "gi");
      let beforeStr = ""; // 替换前的str
      let afterStr = ""; // 替换后的str
      bEle.innerText.replace(reg, function(s, value) {
        beforeStr = s;
        afterStr = `<i style="font-size:inherit;color:${v.color}">${s}</i>`;
        return afterStr;
      });
      let newHtml = bEle.innerHTML;
      newHtml = newHtml.replace(beforeStr, afterStr);
      bEle.innerHTML = newHtml;
    }
  });
  let newText = bEle.innerHTML;
  return newText;
  // return text
}

// 智能检索聚合字典表
let ds_dictionary = {
  专利: {
    na: "专利类型",
    apd: "申请时间",
    nd: "国家地区",
    "in2id.id": "发明人",
    "an1.keyword": "申请人",
    lss: "法律状态",
  },
  文献: {
    keywords: "关键词",
    article_year: "年份",
    author: "学者",
    from_publication: "发表期刊",
  },
  成果: {
    achievement_type: "成果类别",
    registered_date: "年份",
    achievement_stage: "技术成熟度",
    achievement_field: "所属高新技术领域",
    application_status: "应用状态",
    promotion_way: "推广形式",
  },
  标准: {
    kind: "标准类型",
    issue_date: "年份",
    status: "标准状态",
  },
  企业: {
    start_date: "创建时间",
    province_code: "地区",
    new_status_code: "经营状态",
    type_new: "公司类型",
  },
  人才: {
    org: "所属机构",
    patentCount: "专利数量",
  },
  政策: {
    pubdate: "年份",
    source: "来源",
    keywords: "关键字",
  },
  资讯: {
    pubdate: "年份",
    source: "来源",
    keywords: "关键字",
  },
  项目: {
    begin_year: "年份",
    project_country: "国家",
    fund_inst: "资助机构",
    support_inst: "承担机构",
  },
};
export { ds_dictionary };

// 生成分析用的图表数据集
export function refactor(option) {
  let type = option.type || 0;

  if (type === 0) {
    // 例：申请人申请趋势
    let keyArr = [];
    let yearArr = [];
    option.data.forEach((v, i) => {
      if (v.key_as_string !== "不公告发明人" && v.key !== "不公告发明人") {
        keyArr.push({
          key: v.key_as_string || v.key,
          childs: v.childs || [],
        });
        let childs = v.childs || [];
        if (childs.length > 0) {
          childs.forEach((k, j) => {
            yearArr.push(k.key_as_string || k.key);
          });
        }
      }
    });
    // 消除重复的年份，否则会影响提示
    yearArr = Array.from(new Set(yearArr));
    yearArr.sort(function(a, b) {
      return new Date(a) - new Date(b);
    });

    let dataArr = [];
    keyArr.forEach((v, i) => {
      let countArr = [];
      yearArr.forEach((b, j) => {
        let childs = v.childs;
        let count = 0;
        if (childs.length > 0) {
          for (let k in childs) {
            let key = childs[k].key_as_string
              ? childs[k].key_as_string
              : childs[k].key;
            if (b === key) {
              count = childs[k].doc_count;
              break;
            }
          }
        }
        countArr.push(count);
      });
      dataArr.push([v.key, ...countArr]);
    });
    let product = ["product", ...yearArr];
    let refactorData = [product, ...dataArr];
    let refactor = {
      data: refactorData,
      yearArr: yearArr,
      dataArr: dataArr,
    };

    option.callback && option.callback(refactor);
  } else if (type === 1) {
    // 例：申请人专利量
    let xArr = [];
    let yArr = [];
    let refactorData = option.data || [];
    refactorData.forEach((v) => {
      if (v.key !== "不公告发明人") {
        xArr.push(v.key_as_string || v.key);
        yArr.push(v.doc_count);
      }
    });
    option.callback && option.callback({ xArr, yArr });
  } else if (type === 2) {
    // 例：专利申请趋势
    let dataset1 = option.data[0];
    let dataset2 = option.data[1];
    let apdArr = [];
    let isdArr = [];
    let year = [];

    dataset1.forEach((v) => {
      year.push(v.key);
    });
    dataset2.forEach((v) => {
      year.push(v.key);
    });
    year = Array.from(new Set(year));
    year = year.sort((a, b) => {
      return a - b;
    });
    for (let i in year) {
      let v1 = 0;
      d1: for (let j in dataset1) {
        if (year[i] === dataset1[j]["key"]) {
          v1 = dataset1[j]["doc_count"];
          break d1;
        }
      }
      apdArr.push(v1);
      let v2 = 0;
      d2: for (let k in dataset2) {
        if (year[i] === dataset2[k]["key"]) {
          v2 = dataset2[k]["doc_count"];
          break d2;
        }
      }
      isdArr.push(v2);
    }
    let refactorData = [
      ["product", ...year],
      ["申请日", ...apdArr],
      ["公开/公告日", ...isdArr],
    ];
    option.callback && option.callback(refactorData);
  } else if (type === 3) {
    // 关系图
    let nodes = [];
    let links = [];
    let keysArr = [];
    option.data.forEach((v) => {
      let vkey = spaceTxt(v.key);
      keysArr.push(vkey);
      if (v.childs) {
        v.childs.forEach((b) => {
          let bKey = spaceTxt(b.key);
          keysArr.push(bKey);
          links.push({
            source: vkey,
            target: bKey,
            value: b.doc_count,
          });
        });
      }
    });

    keysArr = Array.from(new Set(keysArr));

    for (let i in keysArr) {
      let valueArr = option.data.filter((item) => item.key === keysArr[i]);
      let value = 0;
      if (valueArr.length > 0) {
        value = valueArr[0].doc_count;
      }
      nodes.push({
        name: keysArr[i],
        labelTxt: noSpaceTxt(keysArr[i]),
        value: value,
      });
    }

    let refactor = {
      nodes,
      links,
    };

    option.callback && option.callback(refactor);
  } else if (type === 4) {
    // 气泡图
    let xArr = [];
    let yArr = [];
    let dataArr = [];
    option.data.forEach((v) => {
      yArr.push(v.key);
      if (v.childs && v.childs.length > 0) {
        v.childs.forEach((b) => {
          xArr.push(b.key);
        });
      }
    });

    xArr = Array.from(new Set(xArr));

    xArr.forEach((v, i) => {
      yArr.forEach((b, j) => {
        let keyArr = option.data.filter((item) => item.key === b);
        let childs = keyArr[0].childs;
        let value = 0;
        if (childs.length > 0) {
          for (let k = 0; k < childs.length; k++) {
            if (childs[k].key === v) {
              value = childs[k].doc_count;
              break;
            }
          }
          dataArr.push([i, j, value, b]);
        }
      });
    });

    let refactor = {
      xArr,
      yArr,
      dataArr,
    };
    option.callback && option.callback(refactor);
  } else if (type === 6) {
    // 例：引用度分析
    let xArr = [];
    let yArr = [];
    let refactorData = option.data || [];
    refactorData.forEach((v) => {
      if (v.key !== "不公告发明人") {
        xArr.push(v.key_as_string || v.key);
        yArr.push((v.stats && v.stats.sum) || v.doc_count);
      }
    });
    option.callback && option.callback({ xArr, yArr });
  } else if (type === 8) {
    let seriesData = {};
    seriesData = {
      xData: [], //x轴数组
      paperData: [],
      expertData: [],
      avgData: [],
    };
    option.data.map((item) => {
      seriesData.xData.push(item.key);
      seriesData.paperData.push(item.count);
      seriesData.expertData.push(item.unique_count.value);
      seriesData.avgData.push(item.avg_count.value.toFixed(2));
    });
    option.callback && option.callback({ seriesData });
  }
}

// 高亮-检索式分词处理
export function disassembleWord(text) {
  let arr1 = text.split(" ");
  let arr2 = [];
  arr1.forEach((v) => {
    arr2.push(...v.split("/"));
  });
  let endArr = [];
  arr2.forEach((v) => {
    endArr.push({
      color: "#2f41c8",
      words: v,
    });
  });
  return endArr;
}

// 字符转义和反转义
export function escapeChar(str) {
  str = str
    .toString()
    .replace(/&#xA;/g, "")
    .replace(/&amp;/g, "&")
    .replace(/< img/g, "<img")
    .replace(/< em/g, "<em")
    .replace(/< \/p>/g, "</p>")
    .replace(/ span>/g, "<span>")
    .replace(/&#10/g, "");
  // .replace(/&nbsp;/g, '').replace(/<br>/g, '\n')
  return str;
}

// 是否是中文
export function isZh(str) {
  let regx = new RegExp("[\\u4E00-\\u9FFF]+", "g");
  return regx.test(str);
}

// 国家代码简称转中文
import country from "./mock/country.json";
export function transCNCountry(code) {
  for (let i in country.countrs) {
    if (code === country.countrs[i].code) {
      return country.countrs[i].name || country.countrs[i].cn;
    }
  }
  return code;
}
// 国家中文名转国家代码简称
export function transENCountry(name) {
  for (let i in country.countrs) {
    if (name === country.countrs[i].name) {
      return country.countrs[i].code;
    }
  }
  return name;
}
//图表库中判定是否展示对比分析按钮
export function isShowContrastBtn(label) {
  let flag = true;
  switch (label) {
    case "引用度分析":
      flag = false;
      break;
    case "被引用度分析":
      flag = false;
      break;
    case "二维分析":
      flag = false;
      break;
    case "词云分析":
      flag = false;
      break;
    case "共现网络分析":
      flag = false;
      break;
    case "相关性分析":
      flag = false;
      break;
    case "全球趋势分析":
      flag = false;
      break;

    default:
      flag = true;
      break;
  }
  return flag;
}

// 监视周期映射表
let monitorCycleOptions = [
  { label: "每周", value: "weekly" },
  { label: "每月", value: "monthly" },
];
let mTOptions1 = [
  { label: "周日", value: "Sunday" },
  { label: "周一", value: "Monday" },
  { label: "周二", value: "Tuesday" },
  { label: "周三", value: "Wednesday" },
  { label: "周四", value: "Thursday" },
  { label: "周五", value: "Friday" },
  { label: "周六", value: "Saturday" },
];
let mTOptions2 = [
  { label: "1日", value: "1" },
  { label: "2日", value: "2" },
  { label: "3日", value: "3" },
  { label: "4日", value: "4" },
  { label: "5日", value: "5" },
  { label: "6日", value: "6" },
  { label: "7日", value: "7" },
  { label: "8日", value: "8" },
  { label: "9日", value: "9" },
  { label: "10日", value: "10" },
  { label: "11日", value: "11" },
  { label: "12日", value: "12" },
  { label: "13日", value: "13" },
  { label: "14日", value: "14" },
  { label: "15日", value: "15" },
  { label: "16日", value: "16" },
  { label: "17日", value: "17" },
  { label: "18日", value: "18" },
  { label: "19日", value: "19" },
  { label: "20日", value: "20" },
  { label: "21日", value: "21" },
  { label: "22日", value: "22" },
  { label: "23日", value: "23" },
  { label: "24日", value: "24" },
  { label: "25日", value: "25" },
  { label: "26日", value: "26" },
  { label: "27日", value: "27" },
  { label: "28日", value: "28" },
  { label: "29日", value: "29" },
  { label: "30日", value: "30" },
  { label: "31日", value: "31" },
];
export { monitorCycleOptions, mTOptions1, mTOptions2 };

// 专利检索字段
let pField = [
  "R",
  "B",
  "PN",
  "APN",
  "PNS",
  "APD",
  "ISD",
  "GRD",
  "PRD",
  "TTL",
  "TTL_EN",
  "ABST",
  "ABST_EN",
  "ACLM",
  "ACLM_EN",
  "A",
  "TA",
  "AIM",
  "SPEC",
  "SPEC_EN",
  "FIG",
  "LS",
  "LSS",
  "NA",
  "ND",
  "NS",
  "AS",
  "AN",
  "AN1",
  "ANN",
  "ANN2",
  "AANN",
  "ANTYPE",
  "AN1TYPE",
  "ANNBYPN",
  "IN",
  "IN1",
  "LREP",
  "PRIR",
  "PRIRINFO",
  "ICL",
  "IPC",
  "ICLM",
  "IPCM",
  "lcn",
  "CCL",
  "CCLM",
  "CPC",
  "CPCI",
  "CPCA",
  "CPCM",
  "PAB",
  "INF",
  "CITE",
  "REF",
  "FM",
  "SFM",
  "IC",
  "C",
];
export function patentField(field) {
  for (let i in pField) {
    if (pField[i] === field.toUpperCase()) {
      return true;
    }
  }
  return false;
}
// 复制到剪切板
export function copyToClipboard(searchTxt) {
  const textarea = document.createElement("textarea");
  textarea.setAttribute("readonly", "readonly");
  textarea.value = searchTxt;
  document.body.appendChild(textarea);
  textarea.setSelectionRange(0, textarea.value.length);
  textarea.select();
  document.execCommand("copy");
  if (document.body.removeChild(textarea)) {
    return true;
  } else {
    return false;
  }
}
/*
 * params: 二次检索替换词背景
 * return: 带标签的字符串
 * function: 关键词替换
 * */
export function replaceKeyword(text) {
  if (!text) {
    return text;
  }
  let secondKeyword = top.sessionStorage.getItem("secondeSq");
  let reg = null;
  if (secondKeyword) {
    reg = new RegExp(secondKeyword, "gi");
    text = text.replace(
      reg,
      '<mark class="second-keyword">' + secondKeyword + "</mark>"
    );
  }
  return text;
}

// 删除字符串中的标签
export function deleteTag(str) {
  return str.replace(/(<([^>]+)>)/gi, "");
}
// 删除字符串中的标签
export function handlesShowtopsize(nv) {
  if (
    nv == "全球申请排名" ||
    nv == "全国申请排名" ||
    nv == "主要申请人排名" ||
    nv == "主要发明人排名" ||
    nv == "技术领域排名" ||
    nv == "申请人合作关系" ||
    nv == "发明人合作关系" ||
    nv == "自定义二维分析" ||
    nv == "国家分析" ||
    nv == "机构分析" ||
    nv == "学者分析" ||
    nv == "期刊分析"
  ) {
    return true;
  } else {
    return false;
  }
}

export function toolboxFullScreen(element) {
  let feature = {
    myFull: {
      // 全屏
      show: true,
      title: "全屏显示",
      icon:
        "path://M641.750109 384.100028l205.227128-204.519-0.704035 115.89966c-0.282433 9.611915 7.489578 18.09103 17.101493 17.808598l12.297071 0c9.611915-0.283456 17.667382-5.936199 17.808598-15.689331l0.565888-172.57752c0-0.14224 0.282433-9.187243 0.282433-9.187243 0.14224-4.804423-0.99056-9.187243-4.100388-12.297071-3.109828-3.109828-7.347339-5.086855-12.297071-4.946662l-8.763594 0.14224c-0.141216 0-0.278339 0-0.420579 0.14224L697.581696 98.166787c-9.611915 0.283456-17.667382 8.200776-17.808598 17.950837l0 12.297071c1.416256 11.44875 10.458189 18.092054 20.070104 17.808598l112.789832 0.283456-204.66124 203.814965c-9.329483 9.329483-9.329483 24.449855 0 33.778314 9.329483 9.470699 24.452925 9.470699 33.782408 0L641.750109 384.100028zM383.095141 576.889893 177.726797 780.705881l0.707105-115.338888c0.283456-9.607822-7.492648-18.086937-17.104563-17.808598l-13.001105 0c-9.611915 0.283456-17.667382 5.937223-17.808598 15.690354l-0.565888 172.718737c0 0.14224-0.282433 9.187243-0.282433 9.187243-0.14224 4.808516 0.99056 9.187243 4.096295 12.297071 3.109828 3.109828 7.351432 5.086855 12.297071 4.946662l8.762571-0.14224c0.14224 0 0.283456 0 0.425695-0.14224l171.873486 0.708128c9.607822-0.283456 17.667382-8.196683 17.808598-17.950837L344.93503 832.575226c-1.415232-11.44875-10.461259-18.092054-20.074198-17.808598L212.069977 814.483172 416.59 610.671277c9.329483-9.329483 9.329483-24.453948 0-33.782408C407.40685 567.41817 392.424624 567.41817 383.095141 576.889893L383.095141 576.889893zM894.047276 835.967486l-0.424672-172.718737c-0.283456-9.612938-8.200776-15.406898-17.809621-15.690354l-12.296047 0c-9.612938-0.278339-17.243733 8.200776-17.105586 17.808598l0.708128 115.903753L641.750109 576.889893c-9.329483-9.329483-24.452925-9.329483-33.782408 0-9.325389 9.328459-9.325389 24.452925 0 33.782408L812.490795 814.483172l-112.789832 0.283456c-9.611915-0.283456-18.515702 6.502088-20.073174 17.808598l0 12.297071c0.282433 9.611915 8.200776 17.667382 17.808598 17.950837l171.166381-0.708128c0.141216 0 0.282433 0.14224 0.424672 0.14224l8.763594 0.14224c4.803399 0.141216 9.187243-1.694595 12.296047-4.946662 3.109828-3.109828 4.238534-7.488555 4.097318-12.297071 0 0-0.14224-9.046027-0.14224-9.187243L894.047276 835.968509zM212.216309 146.506748l112.789832-0.283456c9.607822 0.283456 18.512632-6.502088 20.070104-17.808598L345.076246 116.116601c-0.283456-9.611915-8.196683-17.667382-17.808598-17.950837l-172.011632 0.708128c-0.14224 0-0.283456-0.14224-0.425695-0.14224l-8.761548-0.14224c-4.808516-0.141216-9.187243 1.694595-12.297071 4.946662-3.109828 3.109828-4.242627 7.488555-4.096295 12.297071 0 0 0.282433 9.046027 0.282433 9.187243l0.420579 172.718737c0.14224 9.608845 8.200776 15.406898 17.808598 15.686261l13.005198 0c9.611915 0.282433 17.242709-8.196683 17.10047-17.808598l-0.564865-115.334795 205.231221 203.958228c9.324366 9.329483 24.448832 9.329483 33.777291 0 9.329483-9.329483 9.329483-24.452925 0-33.782408L212.216309 146.506748 212.216309 146.506748zM212.216309 146.506748",
      onclick: (e) => {
        // const element = this.$refs.fullScreenBox;
        if (!element) {
          return
        }
        // 全屏查看
        if (element.requestFullScreen) {
          // HTML W3C 提议
          element.requestFullScreen();
        } else if (element.msRequestFullscreen) {
          // IE11
          element.msRequestFullScreen();
        } else if (element.webkitRequestFullScreen) {
          // Webkit
          element.webkitRequestFullScreen();
        } else if (element.mozRequestFullScreen) {
          // Firefox
          element.mozRequestFullScreen();
        }
        // 退出全屏
        if (element.requestFullScreen) {
          document.exitFullscreen();
        } else if (element.msRequestFullScreen) {
          document.msExitFullscreen();
        } else if (element.webkitRequestFullScreen) {
          document.webkitCancelFullScreen();
        } else if (element.mozRequestFullScreen) {
          document.mozCancelFullScreen();
        }
      },
    },
  };
  return feature;
};
